package com.example.aacwebdemo.es2;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport;

/**
 * @author zhao.xin06679
 * @date 2021年06月22日 18:22
 */
@Configuration
public class ElasticSearchConfig  extends ElasticsearchConfigurationSupport {

//    public static final RequestOptions COMMON_OPTIONS;
//
//    static {
//        RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
//        COMMON_OPTIONS = builder.build();
//    }

    @Primary
    @Bean
    public RestHighLevelClient esRestClient(){
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
                new HttpHost("10.100.220.114", 9200, "http")));
        return client;
    }

//    @Bean
//    public ElasticsearchRestTemplate elasticsearchRestTemplate(RestHighLevelClient client
//           ){
//
//        return null;
//
//    }


}